package com.dumas.service;

import com.dumas.dao.BookMapper;
import com.dumas.pojo.Books;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("bookServiceImpl")
public class BookServiceImpl implements BookService{

    //service层调用dao层：组合Dao
    private BookMapper bookMapper;
    public void setBookMapper(BookMapper bookMapper) {
        this.bookMapper = bookMapper;
    }

    @Override
    public void addBooks(Books books) {
        bookMapper.addBooks(books);
    }

    @Override
    public void deleteBooks(int id) {
        bookMapper.deleteBooks(id);
    }

    @Override
    public void updateBooks(Books books) {
        bookMapper.updateBooks(books);
    }

    @Override
    public Books queryBooksById(int bookID) {
        return bookMapper.queryBooksById(bookID);
    }

    @Override
    public List<Books> queryBooksByName(String bookName) {
        return bookMapper.queryBooksByName(bookName);
    }

    @Override
    public List<Books> queryAllBooks() {
        return bookMapper.queryAllBooks();
    }

}
